﻿#ifndef STEP_H
#define STEP_H

#include <QObject>
#include "objectfactory.h"
#include "operation.h"
#include <QJsonObject>
#include <QJsonArray>

class Step : public QObject
{
    Q_OBJECT
public:
    explicit Step(QObject *parent = nullptr);

    Step&       operator= (Step& step);

private:
    QList<Operation*>       m_pOperations;
    QString                 m_strID;
    QObject*                m_pParent;
    bool                    m_isRunning;

public:
    QObject*                GetParent(){return m_pParent;}
    QString                 GetID(){return m_strID;}
    QList<Operation*>&      GetOperations(){return m_pOperations;}
    void                    RemoveOperation(int index){m_pOperations.removeAt(index);}
    bool                    GetRunning(){return m_isRunning;}

public:
    void AddOperation(Operation* pOperation){
        m_pOperations.append(pOperation);
    }

    void Stop();

public:
    bool writeXML(QXmlStreamWriter& xmlWriter);
    void readFromXML(QXmlStreamReader& xmlReader);

    QString strID() const;
    void setStrID(const QString &newStrID);

    void run();

    QList<Operation *> pOperations() const;
    void setPOperations(const QList<Operation *> &newPOperations);

signals:
};

#endif // STEP_H
